#ifndef _NODE_H_
#define _NODE_H_

#include <ros/ros.h>
#include <string>
#include <memory>
#include <fstream>
#include <vector>
#include <pcl/point_types.h>
#include <pcl_conversions/pcl_conversions.h>
#include <sensor_msgs/PointCloud2.h>
#include <std_msgs/String.h>
#include <future>

#include "connector.h"
#include "socketE.h"
#include "Json.h"
#include "talkToFather.h"
#include "Logger.h"


namespace lvpublisher
{

class RosNode
{
public:
    RosNode(int argc, char * argv[]);
    ~RosNode();

    void run();
    
    void pointCloudData();
    void amplitudeData();
    void distanceData();

    void subResponseCallBack(const std_msgs::String::ConstPtr & msg);

private:
    std::string                     m_SN_ID     = "";
    uint16_t                        m_port      = 0;
    std::string                     m_ip        = "";
    std::unique_ptr<Socket>         m_socket    = nullptr;
    std::unique_ptr<Connector>      m_conn      = nullptr;
    easyWebServer::Json             m_dataInfo;
    smartBuffer::SmartBuffer        m_buf;

    ros::NodeHandle                 m_nh;
    ros::Publisher                  m_pubPointCloud;
    ros::Publisher                  m_pubAmplitud;
    ros::Publisher                  m_pubDistance;
    ros::Publisher                  m_pubResponse;

    ros::Subscriber                 m_subResponse;
    std::string                     m_subMsg;
    // std::future<void>               m_subThread;
    bool                            m_ischangeState = false;
};

}


#endif